/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */
package org.ing.sisval.gui.control;

import java.math.BigDecimal;
import java.math.RoundingMode;
import java.util.logging.Level;
import java.util.logging.Logger;
import javax.swing.JOptionPane;
import org.ing.sisval.be.BEDepreciacion;
import org.ing.sisval.be.BEUnitario;
import org.ing.sisval.be.BEValuacionEdificacion;
import org.ing.sisval.be.BEValunitario;
import org.ing.sisval.bl.BLUnitario;
import org.ing.sisval.bl.BLValuacionEdificacion;
import org.ing.sisval.bl.BLValunitario;
import org.ing.sisval.gui.JFPrincipal;
import org.ing.sisval.gui.control.model.ModeloUnitario;
import org.ing.sisval.gui.control.model.ModeloUnitarioAsignado;
import org.ing.sisval.util.UtilDepreciacion;
import org.rx.cr.gui.JInternalFrameUC;
import org.rx.cr.util.Utilitarios;
import static org.rx.cr.util.Utilitarios.addCharacterValidatorEvent;
import static org.rx.cr.util.Utilitarios.addEnterDoclickEvent;
import static org.rx.cr.util.Utilitarios.alinearDatosColumnaTablaCentro;
import static org.rx.cr.util.Utilitarios.formateaAnchoColumnaTabla;

/**
 *
 * @author Mysham
 */
public class JIFValuacionEdificacion extends JInternalFrameUC {

    JFPrincipal parent;
    BEValuacionEdificacion be;
    BLValuacionEdificacion bl;
    ModeloUnitario modeloUnitario;
    UtilDepreciacion utilDepreciacion;
    ModeloUnitarioAsignado modeloUnitarioAsignado;
    BEUnitario bEUnitario;
    BLUnitario bLUnitario;

    BEValunitario bEValunitario;
    BLValunitario bLValunitario;

    /**
     * Creates new form JIFValuacionEdificacion
     *
     * @param parent
     */
    public JIFValuacionEdificacion(JFPrincipal parent) {
        initComponents();
        this.parent = parent;
        modeloUnitario = new ModeloUnitario();
        jtUnitario.setModel(modeloUnitario);

        modeloUnitarioAsignado = new ModeloUnitarioAsignado();
        jtUnitarioAsignado.setModel(modeloUnitarioAsignado);

        utilDepreciacion = new UtilDepreciacion(parent.getConf());
        bl = new BLValuacionEdificacion(parent.getConf());
        bLUnitario = new BLUnitario(parent.getConf());
        bLValunitario = new BLValunitario(parent.getConf());

        personalizaVistaTabla();

        _init();
    }

    /**
     * This method is called from within the constructor to initialize the form.
     * WARNING: Do NOT modify this code. The content of this method is always
     * regenerated by the Form Editor.
     */
    @SuppressWarnings("unchecked")
    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
    private void initComponents() {

        jMenuItem1 = new javax.swing.JMenuItem();
        jbgPiso = new javax.swing.ButtonGroup();
        jPanel1 = new javax.swing.JPanel();
        txfValorTotal = new javax.swing.JTextField();
        jLabel2 = new javax.swing.JLabel();
        jLabel9 = new javax.swing.JLabel();
        txfValorAdicional = new javax.swing.JTextField();
        jcbConsiderar = new javax.swing.JCheckBox();
        jbCalcular = new javax.swing.JButton();
        jLabel13 = new javax.swing.JLabel();
        jbBuscar = new javax.swing.JPanel();
        jScrollPane1 = new javax.swing.JScrollPane();
        jtUnitario = new javax.swing.JTable();
        jbCargar = new javax.swing.JButton();
        txfBuscar = new javax.swing.JTextField();
        jButton1 = new javax.swing.JButton();
        jbAgregarUnitario = new javax.swing.JButton();
        jbSalir = new javax.swing.JButton();
        jbAgregar = new javax.swing.JButton();
        jbCancelar = new javax.swing.JButton();
        jbGuardar = new javax.swing.JButton();
        jPanel3 = new javax.swing.JPanel();
        jLabel4 = new javax.swing.JLabel();
        jcbCategoria = new javax.swing.JComboBox();
        jLabel5 = new javax.swing.JLabel();
        jcbAntiguedad = new javax.swing.JComboBox();
        jLabel6 = new javax.swing.JLabel();
        jcbMaterial = new javax.swing.JComboBox();
        jLabel7 = new javax.swing.JLabel();
        jcbEstado = new javax.swing.JComboBox();
        jLabel8 = new javax.swing.JLabel();
        jcbValorEstado = new javax.swing.JComboBox();
        jbAgregarDepreciacion = new javax.swing.JButton();
        txfValorEstado = new javax.swing.JTextField();
        jLabel15 = new javax.swing.JLabel();
        jPanel2 = new javax.swing.JPanel();
        jScrollPane2 = new javax.swing.JScrollPane();
        jtUnitarioAsignado = new javax.swing.JTable();
        jbQuitar = new javax.swing.JButton();
        jPanel4 = new javax.swing.JPanel();
        jLabel1 = new javax.swing.JLabel();
        jcbTipoEdificacion = new javax.swing.JComboBox();
        jLabel10 = new javax.swing.JLabel();
        jcbCaracteristica = new javax.swing.JComboBox();
        txfNombreCaracteristica = new javax.swing.JTextField();
        jLabel11 = new javax.swing.JLabel();
        txfAntiguedad = new javax.swing.JTextField();
        jLabel12 = new javax.swing.JLabel();
        jLabel3 = new javax.swing.JLabel();
        txfAreaTechada = new javax.swing.JTextField();
        jcbPisoPrimero = new javax.swing.JCheckBox();
        jLabel14 = new javax.swing.JLabel();
        jcbPisoSegundo = new javax.swing.JCheckBox();
        jcbPisoTercero = new javax.swing.JCheckBox();
        jcbPisoCuarto = new javax.swing.JCheckBox();
        jcbPisoQuinto = new javax.swing.JCheckBox();
        jcbPisoSexto = new javax.swing.JCheckBox();
        jcbPisoDecimo = new javax.swing.JCheckBox();
        jcbPisoOctavo = new javax.swing.JCheckBox();
        jcbPisoNoveno = new javax.swing.JCheckBox();
        jcbPisoSeptimo = new javax.swing.JCheckBox();

        jMenuItem1.setText("jMenuItem1");

        setClosable(true);
        setIconifiable(true);
        setTitle("VALUACIÓN DE EDIFICACIÓN");
        setPreferredSize(new java.awt.Dimension(1203, 555));

        jPanel1.setBorder(javax.swing.BorderFactory.createTitledBorder(null, "VALUACION DE EDIFICACIÓN", javax.swing.border.TitledBorder.CENTER, javax.swing.border.TitledBorder.DEFAULT_POSITION));

        txfValorTotal.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                txfValorTotalActionPerformed(evt);
            }
        });

        jLabel2.setText("Valor Total (S/.) :");

        jLabel9.setText("Valor adicional (S/.) * :");

        jcbConsiderar.setText("Considerar");
        jcbConsiderar.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jcbConsiderarActionPerformed(evt);
            }
        });
        jcbConsiderar.addPropertyChangeListener(new java.beans.PropertyChangeListener() {
            public void propertyChange(java.beans.PropertyChangeEvent evt) {
                jcbConsiderarPropertyChange(evt);
            }
        });

        jbCalcular.setText("Calcular");
        jbCalcular.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jbCalcularActionPerformed(evt);
            }
        });

        jLabel13.setText("* Cuando no hay valor unitario de edificación en la tabla.");

        javax.swing.GroupLayout jPanel1Layout = new javax.swing.GroupLayout(jPanel1);
        jPanel1.setLayout(jPanel1Layout);
        jPanel1Layout.setHorizontalGroup(
            jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel1Layout.createSequentialGroup()
                .addGap(0, 0, Short.MAX_VALUE)
                .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(jPanel1Layout.createSequentialGroup()
                        .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                            .addComponent(jLabel9)
                            .addComponent(jLabel2))
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addGroup(jPanel1Layout.createSequentialGroup()
                                .addComponent(txfValorTotal, javax.swing.GroupLayout.PREFERRED_SIZE, 108, javax.swing.GroupLayout.PREFERRED_SIZE)
                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                .addComponent(jbCalcular))
                            .addGroup(jPanel1Layout.createSequentialGroup()
                                .addComponent(txfValorAdicional, javax.swing.GroupLayout.PREFERRED_SIZE, 111, javax.swing.GroupLayout.PREFERRED_SIZE)
                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                .addComponent(jcbConsiderar, javax.swing.GroupLayout.PREFERRED_SIZE, 84, javax.swing.GroupLayout.PREFERRED_SIZE))))
                    .addComponent(jLabel13))
                .addContainerGap())
        );
        jPanel1Layout.setVerticalGroup(
            jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel1Layout.createSequentialGroup()
                .addGap(0, 0, 0)
                .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jLabel9)
                    .addComponent(txfValorAdicional, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jcbConsiderar))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(jLabel13)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(txfValorTotal, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jbCalcular)
                    .addComponent(jLabel2))
                .addGap(0, 0, Short.MAX_VALUE))
        );

        jbBuscar.setBorder(javax.swing.BorderFactory.createTitledBorder(null, "VALORES UNITARIOS DE EDIFICACION", javax.swing.border.TitledBorder.CENTER, javax.swing.border.TitledBorder.DEFAULT_POSITION));

        jtUnitario.setModel(new javax.swing.table.DefaultTableModel(
            new Object [][] {
                {null, null, null, null},
                {null, null, null, null},
                {null, null, null, null},
                {null, null, null, null}
            },
            new String [] {
                "Title 1", "Title 2", "Title 3", "Title 4"
            }
        ));
        jScrollPane1.setViewportView(jtUnitario);

        jbCargar.setText("Cargar");
        jbCargar.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jbCargarActionPerformed(evt);
            }
        });

        txfBuscar.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                txfBuscarActionPerformed(evt);
            }
        });

        jButton1.setIcon(new javax.swing.ImageIcon(getClass().getResource("/org/ing/sisval/imagen/small_buscar.png"))); // NOI18N
        jButton1.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jButton1ActionPerformed(evt);
            }
        });

        jbAgregarUnitario.setIcon(new javax.swing.ImageIcon(getClass().getResource("/org/ing/sisval/imagen/small_agregar.png"))); // NOI18N
        jbAgregarUnitario.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jbAgregarUnitarioActionPerformed(evt);
            }
        });

        javax.swing.GroupLayout jbBuscarLayout = new javax.swing.GroupLayout(jbBuscar);
        jbBuscar.setLayout(jbBuscarLayout);
        jbBuscarLayout.setHorizontalGroup(
            jbBuscarLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jbBuscarLayout.createSequentialGroup()
                .addGroup(jbBuscarLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                    .addComponent(jScrollPane1)
                    .addGroup(jbBuscarLayout.createSequentialGroup()
                        .addComponent(txfBuscar)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(jButton1)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(jbCargar)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(jbAgregarUnitario)))
                .addGap(0, 0, 0))
        );
        jbBuscarLayout.setVerticalGroup(
            jbBuscarLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jbBuscarLayout.createSequentialGroup()
                .addGroup(jbBuscarLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(jButton1)
                    .addComponent(txfBuscar, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jbAgregarUnitario)
                    .addComponent(jbCargar))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(jScrollPane1, javax.swing.GroupLayout.DEFAULT_SIZE, 119, Short.MAX_VALUE))
        );

        jbSalir.setIcon(new javax.swing.ImageIcon(getClass().getResource("/org/ing/sisval/imagen/exit_min.png"))); // NOI18N
        jbSalir.setText("SALIR");
        jbSalir.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER);
        jbSalir.setVerticalAlignment(javax.swing.SwingConstants.BOTTOM);
        jbSalir.setVerticalTextPosition(javax.swing.SwingConstants.BOTTOM);
        jbSalir.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jbSalirActionPerformed(evt);
            }
        });

        jbAgregar.setIcon(new javax.swing.ImageIcon(getClass().getResource("/org/ing/sisval/imagen/Nuevo.png"))); // NOI18N
        jbAgregar.setText("AGREGAR");
        jbAgregar.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER);
        jbAgregar.setVerticalAlignment(javax.swing.SwingConstants.BOTTOM);
        jbAgregar.setVerticalTextPosition(javax.swing.SwingConstants.BOTTOM);
        jbAgregar.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jbAgregarActionPerformed(evt);
            }
        });

        jbCancelar.setIcon(new javax.swing.ImageIcon(getClass().getResource("/org/ing/sisval/imagen/Cancelar_Min.png"))); // NOI18N
        jbCancelar.setText("CANCELAR");
        jbCancelar.setEnabled(false);
        jbCancelar.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER);
        jbCancelar.setVerticalAlignment(javax.swing.SwingConstants.BOTTOM);
        jbCancelar.setVerticalTextPosition(javax.swing.SwingConstants.BOTTOM);
        jbCancelar.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jbCancelarActionPerformed(evt);
            }
        });

        jbGuardar.setIcon(new javax.swing.ImageIcon(getClass().getResource("/org/ing/sisval/imagen/Guardar_Min.png"))); // NOI18N
        jbGuardar.setText("GUARDAR");
        jbGuardar.setEnabled(false);
        jbGuardar.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER);
        jbGuardar.setVerticalAlignment(javax.swing.SwingConstants.BOTTOM);
        jbGuardar.setVerticalTextPosition(javax.swing.SwingConstants.BOTTOM);
        jbGuardar.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jbGuardarActionPerformed(evt);
            }
        });

        jPanel3.setBorder(javax.swing.BorderFactory.createTitledBorder(null, "DEPRECIACIÓN", javax.swing.border.TitledBorder.CENTER, javax.swing.border.TitledBorder.DEFAULT_POSITION));

        jLabel4.setText("Categoría :");

        jcbCategoria.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "Item 1", "Item 2", "Item 3", "Item 4" }));
        jcbCategoria.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jcbCategoriaActionPerformed(evt);
            }
        });

        jLabel5.setText("Antiguedad :");

        jcbAntiguedad.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "Item 1", "Item 2", "Item 3", "Item 4" }));
        jcbAntiguedad.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jcbAntiguedadActionPerformed(evt);
            }
        });

        jLabel6.setText("Material :");

        jcbMaterial.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "Item 1", "Item 2", "Item 3", "Item 4" }));
        jcbMaterial.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jcbMaterialActionPerformed(evt);
            }
        });

        jLabel7.setText("Estado :");

        jcbEstado.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "Item 1", "Item 2", "Item 3", "Item 4" }));
        jcbEstado.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jcbEstadoActionPerformed(evt);
            }
        });

        jLabel8.setText("Valor  :");

        jcbValorEstado.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "Item 1", "Item 2", "Item 3", "Item 4" }));
        jcbValorEstado.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jcbValorEstadoActionPerformed(evt);
            }
        });

        jbAgregarDepreciacion.setIcon(new javax.swing.ImageIcon(getClass().getResource("/org/ing/sisval/imagen/small_agregar.png"))); // NOI18N
        jbAgregarDepreciacion.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jbAgregarDepreciacionActionPerformed(evt);
            }
        });

        jLabel15.setText("* En caso de que no exista el valor en la tabla.");

        javax.swing.GroupLayout jPanel3Layout = new javax.swing.GroupLayout(jPanel3);
        jPanel3.setLayout(jPanel3Layout);
        jPanel3Layout.setHorizontalGroup(
            jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel3Layout.createSequentialGroup()
                .addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                    .addComponent(jLabel4)
                    .addComponent(jLabel5)
                    .addComponent(jLabel6)
                    .addComponent(jLabel7)
                    .addComponent(jLabel8))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(jPanel3Layout.createSequentialGroup()
                        .addComponent(txfValorEstado, javax.swing.GroupLayout.PREFERRED_SIZE, 108, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(jLabel15, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
                    .addComponent(jcbAntiguedad, 0, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                    .addComponent(jcbMaterial, 0, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                    .addComponent(jcbEstado, 0, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                    .addComponent(jcbCategoria, 0, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                    .addGroup(jPanel3Layout.createSequentialGroup()
                        .addComponent(jcbValorEstado, 0, 426, Short.MAX_VALUE)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(jbAgregarDepreciacion)))
                .addGap(5, 5, 5))
        );
        jPanel3Layout.setVerticalGroup(
            jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel3Layout.createSequentialGroup()
                .addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jLabel4)
                    .addComponent(jcbCategoria, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jcbAntiguedad, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jLabel5))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jcbMaterial, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jLabel6))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jcbEstado, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jLabel7))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                        .addComponent(jcbValorEstado, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addComponent(jLabel8))
                    .addComponent(jbAgregarDepreciacion))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(txfValorEstado, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jLabel15))
                .addGap(0, 0, Short.MAX_VALUE))
        );

        jPanel2.setBorder(javax.swing.BorderFactory.createTitledBorder(null, "ASIGNACION DE VALORES UNITARIOS", javax.swing.border.TitledBorder.CENTER, javax.swing.border.TitledBorder.DEFAULT_POSITION));

        jtUnitarioAsignado.setModel(new javax.swing.table.DefaultTableModel(
            new Object [][] {
                {null, null, null, null},
                {null, null, null, null},
                {null, null, null, null},
                {null, null, null, null}
            },
            new String [] {
                "Title 1", "Title 2", "Title 3", "Title 4"
            }
        ));
        jScrollPane2.setViewportView(jtUnitarioAsignado);

        jbQuitar.setIcon(new javax.swing.ImageIcon(getClass().getResource("/org/ing/sisval/imagen/small_cancelar.png"))); // NOI18N
        jbQuitar.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jbQuitarActionPerformed(evt);
            }
        });

        javax.swing.GroupLayout jPanel2Layout = new javax.swing.GroupLayout(jPanel2);
        jPanel2.setLayout(jPanel2Layout);
        jPanel2Layout.setHorizontalGroup(
            jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel2Layout.createSequentialGroup()
                .addGap(0, 0, Short.MAX_VALUE)
                .addComponent(jbQuitar))
            .addComponent(jScrollPane2)
        );
        jPanel2Layout.setVerticalGroup(
            jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel2Layout.createSequentialGroup()
                .addComponent(jbQuitar)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                .addComponent(jScrollPane2, javax.swing.GroupLayout.PREFERRED_SIZE, 100, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addGap(40, 40, 40))
        );

        jPanel4.setBorder(javax.swing.BorderFactory.createTitledBorder(null, "DATOS DE LA EDIFICACIÓN", javax.swing.border.TitledBorder.CENTER, javax.swing.border.TitledBorder.DEFAULT_POSITION));

        jLabel1.setText("Tipo :");

        jcbTipoEdificacion.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "<Seleccionar>", "Casa multifamiliar", "Casa unifamiliar", "Edificio", "Departamento", "Quinta" }));
        jcbTipoEdificacion.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jcbTipoEdificacionActionPerformed(evt);
            }
        });

        jLabel10.setText("Característica :");

        jcbCaracteristica.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "<Seleccionar>", "Area techada", "Area especial" }));
        jcbCaracteristica.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jcbCaracteristicaActionPerformed(evt);
            }
        });

        jLabel11.setText("Antigüedad :");

        jLabel12.setText("año(s)");

        jLabel3.setText("Area techada (m²) :");

        txfAreaTechada.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                txfAreaTechadaActionPerformed(evt);
            }
        });

        jbgPiso.add(jcbPisoPrimero);
        jcbPisoPrimero.setText("1");
        jcbPisoPrimero.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jcbPisoPrimeroActionPerformed(evt);
            }
        });
        jcbPisoPrimero.addPropertyChangeListener(new java.beans.PropertyChangeListener() {
            public void propertyChange(java.beans.PropertyChangeEvent evt) {
                jcbPisoPrimeroPropertyChange(evt);
            }
        });

        jLabel14.setText("Piso :");

        jbgPiso.add(jcbPisoSegundo);
        jcbPisoSegundo.setText("2");
        jcbPisoSegundo.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jcbPisoSegundoActionPerformed(evt);
            }
        });
        jcbPisoSegundo.addPropertyChangeListener(new java.beans.PropertyChangeListener() {
            public void propertyChange(java.beans.PropertyChangeEvent evt) {
                jcbPisoSegundoPropertyChange(evt);
            }
        });

        jbgPiso.add(jcbPisoTercero);
        jcbPisoTercero.setText("3");
        jcbPisoTercero.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jcbPisoTerceroActionPerformed(evt);
            }
        });
        jcbPisoTercero.addPropertyChangeListener(new java.beans.PropertyChangeListener() {
            public void propertyChange(java.beans.PropertyChangeEvent evt) {
                jcbPisoTerceroPropertyChange(evt);
            }
        });

        jbgPiso.add(jcbPisoCuarto);
        jcbPisoCuarto.setText("4");
        jcbPisoCuarto.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jcbPisoCuartoActionPerformed(evt);
            }
        });
        jcbPisoCuarto.addPropertyChangeListener(new java.beans.PropertyChangeListener() {
            public void propertyChange(java.beans.PropertyChangeEvent evt) {
                jcbPisoCuartoPropertyChange(evt);
            }
        });

        jbgPiso.add(jcbPisoQuinto);
        jcbPisoQuinto.setText("5");
        jcbPisoQuinto.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jcbPisoQuintoActionPerformed(evt);
            }
        });
        jcbPisoQuinto.addPropertyChangeListener(new java.beans.PropertyChangeListener() {
            public void propertyChange(java.beans.PropertyChangeEvent evt) {
                jcbPisoQuintoPropertyChange(evt);
            }
        });

        jbgPiso.add(jcbPisoSexto);
        jcbPisoSexto.setText("6");
        jcbPisoSexto.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jcbPisoSextoActionPerformed(evt);
            }
        });
        jcbPisoSexto.addPropertyChangeListener(new java.beans.PropertyChangeListener() {
            public void propertyChange(java.beans.PropertyChangeEvent evt) {
                jcbPisoSextoPropertyChange(evt);
            }
        });

        jbgPiso.add(jcbPisoDecimo);
        jcbPisoDecimo.setText("10");
        jcbPisoDecimo.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jcbPisoDecimoActionPerformed(evt);
            }
        });
        jcbPisoDecimo.addPropertyChangeListener(new java.beans.PropertyChangeListener() {
            public void propertyChange(java.beans.PropertyChangeEvent evt) {
                jcbPisoDecimoPropertyChange(evt);
            }
        });

        jbgPiso.add(jcbPisoOctavo);
        jcbPisoOctavo.setText("8");
        jcbPisoOctavo.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jcbPisoOctavoActionPerformed(evt);
            }
        });
        jcbPisoOctavo.addPropertyChangeListener(new java.beans.PropertyChangeListener() {
            public void propertyChange(java.beans.PropertyChangeEvent evt) {
                jcbPisoOctavoPropertyChange(evt);
            }
        });

        jbgPiso.add(jcbPisoNoveno);
        jcbPisoNoveno.setText("9");
        jcbPisoNoveno.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jcbPisoNovenoActionPerformed(evt);
            }
        });
        jcbPisoNoveno.addPropertyChangeListener(new java.beans.PropertyChangeListener() {
            public void propertyChange(java.beans.PropertyChangeEvent evt) {
                jcbPisoNovenoPropertyChange(evt);
            }
        });

        jbgPiso.add(jcbPisoSeptimo);
        jcbPisoSeptimo.setText("7");
        jcbPisoSeptimo.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jcbPisoSeptimoActionPerformed(evt);
            }
        });
        jcbPisoSeptimo.addPropertyChangeListener(new java.beans.PropertyChangeListener() {
            public void propertyChange(java.beans.PropertyChangeEvent evt) {
                jcbPisoSeptimoPropertyChange(evt);
            }
        });

        javax.swing.GroupLayout jPanel4Layout = new javax.swing.GroupLayout(jPanel4);
        jPanel4.setLayout(jPanel4Layout);
        jPanel4Layout.setHorizontalGroup(
            jPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel4Layout.createSequentialGroup()
                .addGroup(jPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                    .addGroup(jPanel4Layout.createSequentialGroup()
                        .addGroup(jPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                            .addComponent(jLabel3)
                            .addComponent(jLabel11))
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addGroup(jPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addComponent(txfAreaTechada)
                            .addGroup(jPanel4Layout.createSequentialGroup()
                                .addComponent(txfAntiguedad)
                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                .addComponent(jLabel12))))
                    .addGroup(jPanel4Layout.createSequentialGroup()
                        .addGroup(jPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addGroup(jPanel4Layout.createSequentialGroup()
                                .addGap(22, 22, 22)
                                .addGroup(jPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                                    .addComponent(jLabel10)
                                    .addComponent(jLabel1)))
                            .addComponent(jLabel14, javax.swing.GroupLayout.Alignment.TRAILING))
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addGroup(jPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addComponent(jcbTipoEdificacion, 0, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                            .addComponent(jcbCaracteristica, 0, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                            .addGroup(jPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                                .addGroup(jPanel4Layout.createSequentialGroup()
                                    .addComponent(jcbPisoSexto)
                                    .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                    .addComponent(jcbPisoSeptimo)
                                    .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                    .addComponent(jcbPisoOctavo)
                                    .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                    .addComponent(jcbPisoNoveno)
                                    .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                    .addComponent(jcbPisoDecimo))
                                .addGroup(jPanel4Layout.createSequentialGroup()
                                    .addComponent(jcbPisoPrimero)
                                    .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                    .addComponent(jcbPisoSegundo)
                                    .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                    .addComponent(jcbPisoTercero)
                                    .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                    .addComponent(jcbPisoCuarto)
                                    .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                    .addComponent(jcbPisoQuinto))
                                .addComponent(txfNombreCaracteristica)))))
                .addGap(0, 0, 0))
        );
        jPanel4Layout.setVerticalGroup(
            jPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel4Layout.createSequentialGroup()
                .addGroup(jPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jLabel1)
                    .addComponent(jcbTipoEdificacion, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(jPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jcbCaracteristica, javax.swing.GroupLayout.PREFERRED_SIZE, 24, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jLabel10))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(jPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jcbPisoPrimero)
                    .addComponent(jLabel14)
                    .addComponent(jcbPisoSegundo)
                    .addComponent(jcbPisoTercero)
                    .addComponent(jcbPisoCuarto)
                    .addComponent(jcbPisoQuinto))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(jPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jcbPisoSexto)
                    .addComponent(jcbPisoSeptimo)
                    .addComponent(jcbPisoOctavo)
                    .addComponent(jcbPisoNoveno)
                    .addComponent(jcbPisoDecimo))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(txfNombreCaracteristica, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(jPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(txfAntiguedad, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jLabel12)
                    .addComponent(jLabel11))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(jPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(txfAreaTechada, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jLabel3))
                .addContainerGap(20, Short.MAX_VALUE))
        );

        javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
        getContentPane().setLayout(layout);
        layout.setHorizontalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addComponent(jbBuscar, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
            .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
                .addComponent(jPanel3, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(jPanel4, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
                    .addGroup(layout.createSequentialGroup()
                        .addComponent(jbAgregar, javax.swing.GroupLayout.PREFERRED_SIZE, 86, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(jbGuardar)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(jbCancelar)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(jbSalir))
                    .addComponent(jPanel1, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)))
            .addComponent(jPanel2, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
        );
        layout.setVerticalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(layout.createSequentialGroup()
                .addComponent(jbBuscar, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(jPanel2, javax.swing.GroupLayout.PREFERRED_SIZE, 156, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(layout.createSequentialGroup()
                        .addComponent(jPanel1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addGap(18, 18, 18)
                        .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
                            .addComponent(jbCancelar, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                            .addComponent(jbAgregar, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                            .addComponent(jbGuardar, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                            .addComponent(jbSalir, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
                        .addContainerGap())
                    .addComponent(jPanel3, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                    .addComponent(jPanel4, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)))
        );

        pack();
    }// </editor-fold>//GEN-END:initComponents

    private void txfValorTotalActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_txfValorTotalActionPerformed
        // TODO add your handling code here:
    }//GEN-LAST:event_txfValorTotalActionPerformed

    private void jbSalirActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jbSalirActionPerformed
        // TODO add your handling code here:
        dispose();
    }//GEN-LAST:event_jbSalirActionPerformed

    private void txfBuscarActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_txfBuscarActionPerformed
        // TODO add your handling code here:
    }//GEN-LAST:event_txfBuscarActionPerformed

    private void jbCancelarActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jbCancelarActionPerformed
        // TODO add your handling code here:
        _resetControls();
    }//GEN-LAST:event_jbCancelarActionPerformed

    private void jcbCategoriaActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jcbCategoriaActionPerformed
        // TODO add your handling code here:
        eventoComboCategoria();
    }//GEN-LAST:event_jcbCategoriaActionPerformed

    private void jcbAntiguedadActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jcbAntiguedadActionPerformed
        // TODO add your handling code here:
        eventoComboAntiguedad();
    }//GEN-LAST:event_jcbAntiguedadActionPerformed

    private void jcbMaterialActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jcbMaterialActionPerformed
        // TODO add your handling code here:
        eventoComboMaterial();
    }//GEN-LAST:event_jcbMaterialActionPerformed

    private void jcbEstadoActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jcbEstadoActionPerformed
        // TODO add your handling code here:
        eventoComboEstado();
    }//GEN-LAST:event_jcbEstadoActionPerformed

    private void jcbValorEstadoActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jcbValorEstadoActionPerformed
        // TODO add your handling code here:
        eventoComboValorEstado();
    }//GEN-LAST:event_jcbValorEstadoActionPerformed

    private void jbCargarActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jbCargarActionPerformed
        // TODO add your handling code here:
        //personalizaVistaTabla();
        if (jtUnitario.getSelectedRow() >= 0) {
            agregarUnitario(modeloUnitario.get(jtUnitario.getSelectedRow()));
            personalizaVistaTabla();
        } else {
            JOptionPane.showMessageDialog(this, "Seleccione un valor unitario de la tabla.", "Atención.", JOptionPane.INFORMATION_MESSAGE);
        }
        personalizaVistaTabla();


    }//GEN-LAST:event_jbCargarActionPerformed

    private void jbQuitarActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jbQuitarActionPerformed
        // TODO add your handling code here:
        try {
            if (jtUnitarioAsignado.getSelectedRow() >= 0) {
                modeloUnitarioAsignado.remove(jtUnitarioAsignado.getSelectedRow());
            } else {
                JOptionPane.showMessageDialog(this, "Seleccione el elemento a eliminar.", "Atención.", JOptionPane.INFORMATION_MESSAGE);

            }
        } catch (Exception e) {
            JOptionPane.showMessageDialog(this, "Error al eliminar el valor unitario de la tabla. " + e, "Atención.", JOptionPane.INFORMATION_MESSAGE);
            Logger.getLogger(JIFValuacionEdificacion.class.getName()).log(Level.SEVERE, null, e);
        }
        personalizaVistaTabla();
    }//GEN-LAST:event_jbQuitarActionPerformed

    private void jbCalcularActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jbCalcularActionPerformed
        // TODO add your handling code here:
        if (!txfValorEstado.getText().isEmpty() && !txfAreaTechada.getText().isEmpty()) {
            Double vu = redondear(sumaUnitario());
            Double p = redondear(Double.parseDouble(txfValorEstado.getText()));
            Double areaTechada = redondear(Double.parseDouble(txfAreaTechada.getText()));

            Double valorTotal = 0.0;

            if (jcbConsiderar.isSelected()) {
                Double valorAdicional = redondear(Double.parseDouble(txfValorAdicional.getText()));
                valorTotal = redondear(vu * areaTechada * (1 - (p / 100)) + valorAdicional);
            } else if (!jcbConsiderar.isSelected()) {
                valorTotal = redondear(vu * areaTechada * (1 - (p / 100)));
            }
            txfValorTotal.setText(Double.toString(redondear(valorTotal)));
        } else {
            JOptionPane.showMessageDialog(this, "Los valores no estan completos", "Valuación de Edificacion", JOptionPane.INFORMATION_MESSAGE);
        }


    }//GEN-LAST:event_jbCalcularActionPerformed

    private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton1ActionPerformed
        // TODO add your handling code here:
    }//GEN-LAST:event_jButton1ActionPerformed

    private void txfAreaTechadaActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_txfAreaTechadaActionPerformed
        // TODO add your handling code here:
    }//GEN-LAST:event_txfAreaTechadaActionPerformed

    private void jbAgregarUnitarioActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jbAgregarUnitarioActionPerformed
        // TODO add your handling code here:
        parent.insertarInternalFrame(parent.administrarUnitario);
    }//GEN-LAST:event_jbAgregarUnitarioActionPerformed

    private void jbAgregarDepreciacionActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jbAgregarDepreciacionActionPerformed
        // TODO add your handling code here:
        parent.insertarInternalFrame(parent.administrarDepreciacion);
    }//GEN-LAST:event_jbAgregarDepreciacionActionPerformed

    private void jcbConsiderarPropertyChange(java.beans.PropertyChangeEvent evt) {//GEN-FIRST:event_jcbConsiderarPropertyChange
        // TODO add your handling code here:
        if (jcbConsiderar.isSelected()) {
            txfValorAdicional.setEnabled(true);
        } else {
            txfValorAdicional.setText("");
            txfValorAdicional.setEnabled(false);
        }
    }//GEN-LAST:event_jcbConsiderarPropertyChange

    private void jcbTipoEdificacionActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jcbTipoEdificacionActionPerformed
        // TODO add your handling code here:
    }//GEN-LAST:event_jcbTipoEdificacionActionPerformed

    private void jcbCaracteristicaActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jcbCaracteristicaActionPerformed
        // TODO add your handling code here:
        txfNombreCaracteristica.setText("");
        jbgPiso.clearSelection();
        try {
            if (_OPERACION != _DESCONOCIDO) {
                switch (jcbCaracteristica.getSelectedIndex()) {
                    case 1://area techada                        
                        jcbPisoPrimero.setEnabled(true);
                        jcbPisoSegundo.setEnabled(true);
                        jcbPisoTercero.setEnabled(true);
                        jcbPisoCuarto.setEnabled(true);
                        jcbPisoQuinto.setEnabled(true);
                        jcbPisoSexto.setEnabled(true);
                        jcbPisoSeptimo.setEnabled(true);
                        jcbPisoOctavo.setEnabled(true);
                        jcbPisoNoveno.setEnabled(true);
                        jcbPisoDecimo.setEnabled(true);
                        break;
                    case 2:// area especial                       
                        jcbPisoPrimero.setSelected(false);
                        jcbPisoPrimero.setEnabled(false);
                        jcbPisoSegundo.setSelected(false);
                        jcbPisoSegundo.setEnabled(false);
                        jcbPisoTercero.setSelected(false);
                        jcbPisoTercero.setEnabled(false);
                        jcbPisoCuarto.setSelected(false);
                        jcbPisoCuarto.setEnabled(false);
                        jcbPisoQuinto.setSelected(false);
                        jcbPisoQuinto.setEnabled(false);
                        jcbPisoSexto.setSelected(false);
                        jcbPisoSexto.setEnabled(false);
                        jcbPisoSeptimo.setSelected(false);
                        jcbPisoSeptimo.setEnabled(false);
                        jcbPisoOctavo.setSelected(false);
                        jcbPisoOctavo.setEnabled(false);
                        jcbPisoNoveno.setSelected(false);
                        jcbPisoNoveno.setEnabled(false);
                        jcbPisoDecimo.setSelected(false);
                        jcbPisoDecimo.setEnabled(false);
                        txfNombreCaracteristica.setEnabled(true);

                        break;
                }
            }
        } catch (Exception e) {
            JOptionPane.showMessageDialog(this, "Error al habilitar y deshabilitar componentes. " + e, "Atención.", JOptionPane.INFORMATION_MESSAGE);

        }
    }//GEN-LAST:event_jcbCaracteristicaActionPerformed

    private void jcbConsiderarActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jcbConsiderarActionPerformed
        // TODO add your handling code here:
    }//GEN-LAST:event_jcbConsiderarActionPerformed

    private void jcbPisoPrimeroActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jcbPisoPrimeroActionPerformed
        // TODO add your handling code here:
    }//GEN-LAST:event_jcbPisoPrimeroActionPerformed

    private void jcbPisoPrimeroPropertyChange(java.beans.PropertyChangeEvent evt) {//GEN-FIRST:event_jcbPisoPrimeroPropertyChange
        // TODO add your handling code here:
        if (jcbPisoPrimero.isSelected()) {
            txfNombreCaracteristica.setText("Primer piso");
            txfNombreCaracteristica.setEnabled(false);
        }
    }//GEN-LAST:event_jcbPisoPrimeroPropertyChange

    private void jbAgregarActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jbAgregarActionPerformed
        // TODO add your handling code here:
    }//GEN-LAST:event_jbAgregarActionPerformed

    private void jbGuardarActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jbGuardarActionPerformed
        // TODO add your handling code here:
    }//GEN-LAST:event_jbGuardarActionPerformed

    private void jcbPisoSegundoActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jcbPisoSegundoActionPerformed
        // TODO add your handling code here:
    }//GEN-LAST:event_jcbPisoSegundoActionPerformed

    private void jcbPisoSegundoPropertyChange(java.beans.PropertyChangeEvent evt) {//GEN-FIRST:event_jcbPisoSegundoPropertyChange
        // TODO add your handling code here:
        if (jcbPisoSegundo.isSelected()) {
            txfNombreCaracteristica.setText("Segundo piso");
            txfNombreCaracteristica.setEnabled(false);
        }
    }//GEN-LAST:event_jcbPisoSegundoPropertyChange

    private void jcbPisoTerceroActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jcbPisoTerceroActionPerformed
        // TODO add your handling code here:
    }//GEN-LAST:event_jcbPisoTerceroActionPerformed

    private void jcbPisoTerceroPropertyChange(java.beans.PropertyChangeEvent evt) {//GEN-FIRST:event_jcbPisoTerceroPropertyChange
        // TODO add your handling code here:
        if (jcbPisoTercero.isSelected()) {
            txfNombreCaracteristica.setText("Tercer piso");
            txfNombreCaracteristica.setEnabled(false);
        }
    }//GEN-LAST:event_jcbPisoTerceroPropertyChange

    private void jcbPisoCuartoActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jcbPisoCuartoActionPerformed
        // TODO add your handling code here:
    }//GEN-LAST:event_jcbPisoCuartoActionPerformed

    private void jcbPisoCuartoPropertyChange(java.beans.PropertyChangeEvent evt) {//GEN-FIRST:event_jcbPisoCuartoPropertyChange
        // TODO add your handling code here:
        if (jcbPisoCuarto.isSelected()) {
            txfNombreCaracteristica.setText("Cuarto piso");
            txfNombreCaracteristica.setEnabled(false);
        }
    }//GEN-LAST:event_jcbPisoCuartoPropertyChange

    private void jcbPisoQuintoActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jcbPisoQuintoActionPerformed
        // TODO add your handling code here:
    }//GEN-LAST:event_jcbPisoQuintoActionPerformed

    private void jcbPisoQuintoPropertyChange(java.beans.PropertyChangeEvent evt) {//GEN-FIRST:event_jcbPisoQuintoPropertyChange
        // TODO add your handling code here:
        if (jcbPisoQuinto.isSelected()) {
            txfNombreCaracteristica.setText("Quinto piso");
            txfNombreCaracteristica.setEnabled(false);
        }
    }//GEN-LAST:event_jcbPisoQuintoPropertyChange

    private void jcbPisoSextoActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jcbPisoSextoActionPerformed
        // TODO add your handling code here:
    }//GEN-LAST:event_jcbPisoSextoActionPerformed

    private void jcbPisoSextoPropertyChange(java.beans.PropertyChangeEvent evt) {//GEN-FIRST:event_jcbPisoSextoPropertyChange
        // TODO add your handling code here:
        if (jcbPisoSexto.isSelected()) {
            txfNombreCaracteristica.setText("Sexto piso");
            txfNombreCaracteristica.setEnabled(false);
        }
    }//GEN-LAST:event_jcbPisoSextoPropertyChange

    private void jcbPisoDecimoActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jcbPisoDecimoActionPerformed
        // TODO add your handling code here:
    }//GEN-LAST:event_jcbPisoDecimoActionPerformed

    private void jcbPisoDecimoPropertyChange(java.beans.PropertyChangeEvent evt) {//GEN-FIRST:event_jcbPisoDecimoPropertyChange
        // TODO add your handling code here:
        if (jcbPisoDecimo.isSelected()) {
            txfNombreCaracteristica.setText("Décimo piso");
            txfNombreCaracteristica.setEnabled(false);
        }
    }//GEN-LAST:event_jcbPisoDecimoPropertyChange

    private void jcbPisoOctavoActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jcbPisoOctavoActionPerformed
        // TODO add your handling code here:
    }//GEN-LAST:event_jcbPisoOctavoActionPerformed

    private void jcbPisoOctavoPropertyChange(java.beans.PropertyChangeEvent evt) {//GEN-FIRST:event_jcbPisoOctavoPropertyChange
        // TODO add your handling code here:
        if (jcbPisoOctavo.isSelected()) {
            txfNombreCaracteristica.setText("Octavo piso");
            txfNombreCaracteristica.setEnabled(false);
        }
    }//GEN-LAST:event_jcbPisoOctavoPropertyChange

    private void jcbPisoNovenoActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jcbPisoNovenoActionPerformed
        // TODO add your handling code here:
    }//GEN-LAST:event_jcbPisoNovenoActionPerformed

    private void jcbPisoNovenoPropertyChange(java.beans.PropertyChangeEvent evt) {//GEN-FIRST:event_jcbPisoNovenoPropertyChange
        // TODO add your handling code here:
        if (jcbPisoNoveno.isSelected()) {
            txfNombreCaracteristica.setText("Noveno piso");
            txfNombreCaracteristica.setEnabled(false);
        }
    }//GEN-LAST:event_jcbPisoNovenoPropertyChange

    private void jcbPisoSeptimoActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jcbPisoSeptimoActionPerformed
        // TODO add your handling code here:
    }//GEN-LAST:event_jcbPisoSeptimoActionPerformed

    private void jcbPisoSeptimoPropertyChange(java.beans.PropertyChangeEvent evt) {//GEN-FIRST:event_jcbPisoSeptimoPropertyChange
        // TODO add your handling code here:
        if (jcbPisoSeptimo.isSelected()) {
            txfNombreCaracteristica.setText("Séptimo piso");
            txfNombreCaracteristica.setEnabled(false);
        }
    }//GEN-LAST:event_jcbPisoSeptimoPropertyChange


    // Variables declaration - do not modify//GEN-BEGIN:variables
    private javax.swing.JButton jButton1;
    private javax.swing.JLabel jLabel1;
    private javax.swing.JLabel jLabel10;
    private javax.swing.JLabel jLabel11;
    private javax.swing.JLabel jLabel12;
    private javax.swing.JLabel jLabel13;
    private javax.swing.JLabel jLabel14;
    private javax.swing.JLabel jLabel15;
    private javax.swing.JLabel jLabel2;
    private javax.swing.JLabel jLabel3;
    private javax.swing.JLabel jLabel4;
    private javax.swing.JLabel jLabel5;
    private javax.swing.JLabel jLabel6;
    private javax.swing.JLabel jLabel7;
    private javax.swing.JLabel jLabel8;
    private javax.swing.JLabel jLabel9;
    private javax.swing.JMenuItem jMenuItem1;
    private javax.swing.JPanel jPanel1;
    private javax.swing.JPanel jPanel2;
    private javax.swing.JPanel jPanel3;
    private javax.swing.JPanel jPanel4;
    private javax.swing.JScrollPane jScrollPane1;
    private javax.swing.JScrollPane jScrollPane2;
    private javax.swing.JButton jbAgregar;
    private javax.swing.JButton jbAgregarDepreciacion;
    private javax.swing.JButton jbAgregarUnitario;
    private javax.swing.JPanel jbBuscar;
    private javax.swing.JButton jbCalcular;
    private javax.swing.JButton jbCancelar;
    private javax.swing.JButton jbCargar;
    private javax.swing.JButton jbGuardar;
    private javax.swing.JButton jbQuitar;
    private javax.swing.JButton jbSalir;
    private javax.swing.ButtonGroup jbgPiso;
    private javax.swing.JComboBox jcbAntiguedad;
    private javax.swing.JComboBox jcbCaracteristica;
    private javax.swing.JComboBox jcbCategoria;
    private javax.swing.JCheckBox jcbConsiderar;
    private javax.swing.JComboBox jcbEstado;
    private javax.swing.JComboBox jcbMaterial;
    private javax.swing.JCheckBox jcbPisoCuarto;
    private javax.swing.JCheckBox jcbPisoDecimo;
    private javax.swing.JCheckBox jcbPisoNoveno;
    private javax.swing.JCheckBox jcbPisoOctavo;
    private javax.swing.JCheckBox jcbPisoPrimero;
    private javax.swing.JCheckBox jcbPisoQuinto;
    private javax.swing.JCheckBox jcbPisoSegundo;
    private javax.swing.JCheckBox jcbPisoSeptimo;
    private javax.swing.JCheckBox jcbPisoSexto;
    private javax.swing.JCheckBox jcbPisoTercero;
    private javax.swing.JComboBox jcbTipoEdificacion;
    private javax.swing.JComboBox jcbValorEstado;
    private javax.swing.JTable jtUnitario;
    private javax.swing.JTable jtUnitarioAsignado;
    private javax.swing.JTextField txfAntiguedad;
    private javax.swing.JTextField txfAreaTechada;
    private javax.swing.JTextField txfBuscar;
    private javax.swing.JTextField txfNombreCaracteristica;
    private javax.swing.JTextField txfValorAdicional;
    private javax.swing.JTextField txfValorEstado;
    private javax.swing.JTextField txfValorTotal;
    // End of variables declaration//GEN-END:variables

    @Override
    public void _cargarCombos() throws Exception {
        utilDepreciacion.defaultSelectedDepreciacion("", "", "", "", 0, jcbCategoria, jcbAntiguedad, jcbMaterial, jcbEstado, jcbValorEstado);
    }

    @Override
    public void _agregaValidadoresControl() {
        addEnterDoclickEvent(new Object[][]{{txfBuscar, jButton1}});
        _addOperationEventsButtons(jbAgregar, jbGuardar, jbCancelar);
        _addRestoreDataEventsTable(jtUnitario);
        _addSearchEventsButton(jButton1);
        addCharacterValidatorEvent(new Object[][]{
            {txfAreaTechada, Utilitarios.NUMERICO_REAL, 180},
            {txfValorAdicional, Utilitarios.NUMERICO_REAL, 180},
            {txfAntiguedad, Utilitarios.NUMERICO, 2}

        });
    }

    @Override
    public boolean _isDatosValidosBE() {
        return Utilitarios.isDatosLlenos(new Object[][]{
            {txfAreaTechada, "Ingresar el valor del area techada."},
            {txfAntiguedad, "Ingresar la antigüedad de la edificación."},
            {txfNombreCaracteristica, "Ingresar la denominación del área."},
            {txfValorTotal, "Calcular el valor total de edificación con el botón 'calcular'."}
        });
    }

    @Override
    public int _registrarBE() throws Exception {

        be = new BEValuacionEdificacion();
        be.setValortotal(Double.parseDouble(txfValorTotal.getText()));
        if (jcbValorEstado.getSelectedIndex() == 0) {
            be.setDepreciacionid(0);
        } else {
            be.setDepreciacionid(((BEDepreciacion) jcbValorEstado.getSelectedItem()).getDepreciacionid());
        }

        if (!txfValorAdicional.getText().isEmpty()) {
            be.setValorAdicional(Double.parseDouble(txfValorAdicional.getText()));
        } else {
            be.setValorAdicional(0);
        }
        be.setAreaTechada(Double.parseDouble(txfAreaTechada.getText()));
        be.setTipoedificacion(jcbTipoEdificacion.getSelectedItem().toString());
        be.setCaracteristica(jcbCaracteristica.getSelectedItem().toString());
        be.setNombrecaracteristica(txfNombreCaracteristica.getText());
        be.setAntiguedad(Integer.parseInt(txfAntiguedad.getText()));
        be.setValorEstado(Double.parseDouble(txfValorEstado.getText()));

        int idcomp = bl.obtenerUltimoId();

        bl.registrar(be);

        int id = bl.obtenerUltimoId();
        if (idcomp != id) {
            for (BEUnitario s : modeloUnitarioAsignado.getList()) {
                bEValunitario = new BEValunitario();
                bEValunitario.setValuacionEdificacionId(id);
                bEValunitario.setUnitarioid(s.getUnitarioid());
                bLValunitario.registrar(bEValunitario);
            }
        }

        JOptionPane.showMessageDialog(this, "Registro satisfactorio del equipo", "Valuación de edificación", JOptionPane.INFORMATION_MESSAGE);

        cargar();
        dispose();

        _resetControls();
        _deshabilitarControlesDatos();
        _listarBEs();
        return id;
    }

    @Override
    public int _guardarCambiosBE() throws Exception {
        be.setValortotal(Double.parseDouble(txfValorTotal.getText()));
        if (jcbValorEstado.getSelectedIndex() == 0) {
            be.setDepreciacionid(0);
        } else {
            be.setDepreciacionid(((BEDepreciacion) jcbValorEstado.getSelectedItem()).getDepreciacionid());
        }
        be.setValorAdicional(Double.parseDouble(txfValorAdicional.getText()));
        be.setAreaTechada(Double.parseDouble(txfAreaTechada.getText()));
        be.setTipoedificacion(jcbTipoEdificacion.getSelectedItem().toString());
        be.setCaracteristica(jcbCaracteristica.getSelectedItem().toString());
        be.setNombrecaracteristica(txfNombreCaracteristica.getText());
        be.setAntiguedad(Integer.parseInt(txfAntiguedad.getText()));
        be.setValorEstado(Double.parseDouble(txfValorEstado.getText()));

        int rsp = bl.actualizarRegistro(be);

        // cargar valunitario       
        int idvu = modeloUnitario.get(jtUnitario.getSelectedRow()).getUnitarioid();

        if (!bLValunitario.listarAsignacion(idvu).isEmpty()) {
            bLValunitario.eliminarAsignacion(idvu);
        }

        for (BEUnitario c : modeloUnitarioAsignado.getList()) {
            bEValunitario = new BEValunitario();
            bEValunitario.setValuacionEdificacionId(idvu);
            bEValunitario.setUnitarioid(c.getUnitarioid());
            bLValunitario.registrar(bEValunitario);
        }
        JOptionPane.showMessageDialog(this, "Actualización de registro satisfactorio", "Valuación de edificación", JOptionPane.INFORMATION_MESSAGE);

        _resetControls();
        _deshabilitarControlesDatos();
        _listarBEs();
        return rsp;
    }

    @Override
    public void _listarBEs() throws Exception {
        modeloUnitario.addAll(bLUnitario.buscarReferencia(txfBuscar.getText()));
        personalizaVistaTabla();
    }

    @Override
    public void _recuperarDatosBE() throws Exception {

    }

    @Override
    public void _deshabilitarControlesDatos() {
        Utilitarios.disableComponent(new Object[]{
            txfAreaTechada, txfValorAdicional, txfValorTotal,
            jcbCategoria, jcbAntiguedad, jcbMaterial, jcbEstado,
            jcbValorEstado,
            jcbConsiderar, jbCalcular, jtUnitarioAsignado,
            jbCargar, jtUnitario, jbQuitar, jcbTipoEdificacion, txfNombreCaracteristica,
            jcbCaracteristica, txfAntiguedad, jbAgregarDepreciacion, jbAgregarUnitario, jcbPisoPrimero,
            jcbPisoSegundo, jcbPisoTercero, jcbPisoCuarto, jcbPisoQuinto,
            jcbPisoSexto, jcbPisoSeptimo, jcbPisoOctavo, jcbPisoNoveno, jcbPisoDecimo, txfValorEstado});
    }

    @Override
    public void _habilitarControlesDatos() {
        Utilitarios.enableComponent(new Object[]{
            txfAreaTechada, txfValorAdicional, txfValorTotal,
            jcbCategoria, jcbAntiguedad, jcbMaterial, jcbEstado,
            jcbValorEstado,
            jcbConsiderar, jbCalcular, jtUnitarioAsignado, txfAntiguedad,
            jbCargar, jtUnitario, jbQuitar, jcbTipoEdificacion,
            txfNombreCaracteristica, jcbCaracteristica, jbAgregarDepreciacion, jbAgregarUnitario, jcbPisoPrimero,
            jcbPisoSegundo, jcbPisoTercero, jcbPisoCuarto, jcbPisoQuinto,
            jcbPisoSexto, jcbPisoSeptimo, jcbPisoOctavo, jcbPisoNoveno, jcbPisoDecimo, txfValorEstado});
        txfValorTotal.setEditable(false);
        jcbPisoPrimero.setEnabled(false);
        jcbPisoSegundo.setEnabled(false);
        jcbPisoTercero.setEnabled(false);
        jcbPisoCuarto.setEnabled(false);
        jcbPisoQuinto.setEnabled(false);
        jcbPisoSexto.setEnabled(false);
        jcbPisoSeptimo.setEnabled(false);
        jcbPisoOctavo.setEnabled(false);
        jcbPisoNoveno.setEnabled(false);
        jcbPisoDecimo.setEnabled(false);
        try {
            _listarBEs();

        } catch (Exception ex) {
            Logger.getLogger(JIFValuacionEdificacion.class.getName()).log(Level.SEVERE, null, ex);
        }
        personalizaVistaTabla();
        if (jcbConsiderar.isSelected()) {
            txfValorAdicional.setEnabled(true);
        } else {
            txfValorAdicional.setEnabled(false);
        }
    }

    @Override
    public void _resetControls() {
        Utilitarios.resetComponents(new Object[]{
            txfAreaTechada, txfValorAdicional, txfValorTotal,
            jcbCategoria, jcbAntiguedad, jcbMaterial, jcbEstado,
            jcbValorEstado,
            jcbConsiderar, jbCalcular, txfAntiguedad,
            jbCargar, jtUnitario, jbQuitar,
            jcbTipoEdificacion, txfNombreCaracteristica, jcbCaracteristica,
            jbAgregarDepreciacion, jbAgregarUnitario, txfValorEstado
        });
        txfValorTotal.setEditable(false);
        modeloUnitarioAsignado.clear();
        modeloUnitario.clear();
        if (jcbConsiderar.isSelected()) {
            txfValorAdicional.setEnabled(true);
        } else {
            txfValorAdicional.setEnabled(false);
        }
        jcbPisoPrimero.setSelected(false);
        jcbPisoPrimero.setEnabled(false);
        jcbPisoSegundo.setSelected(false);
        jcbPisoSegundo.setEnabled(false);
        jcbPisoTercero.setSelected(false);
        jcbPisoTercero.setEnabled(false);
        jcbPisoCuarto.setSelected(false);
        jcbPisoCuarto.setEnabled(false);
        jcbPisoQuinto.setSelected(false);
        jcbPisoQuinto.setEnabled(false);
        jcbPisoSexto.setSelected(false);
        jcbPisoSexto.setEnabled(false);
        jcbPisoSeptimo.setSelected(false);
        jcbPisoSeptimo.setEnabled(false);
        jcbPisoOctavo.setSelected(false);
        jcbPisoOctavo.setEnabled(false);
        jcbPisoNoveno.setSelected(false);
        jcbPisoNoveno.setEnabled(false);
        jcbPisoDecimo.setSelected(false);
        jcbPisoDecimo.setEnabled(false);
    }

    private void personalizaVistaTabla() {
        alinearDatosColumnaTablaCentro(0, jtUnitario);
        alinearDatosColumnaTablaCentro(1, jtUnitario);
        alinearDatosColumnaTablaCentro(2, jtUnitario);
        alinearDatosColumnaTablaCentro(3, jtUnitario);
        formateaAnchoColumnaTabla(0, jtUnitario, 220);
        formateaAnchoColumnaTabla(1, jtUnitario, 220);
        formateaAnchoColumnaTabla(2, jtUnitario, 645);
        formateaAnchoColumnaTabla(3, jtUnitario, 100);

        alinearDatosColumnaTablaCentro(0, jtUnitarioAsignado);
        alinearDatosColumnaTablaCentro(1, jtUnitarioAsignado);
        alinearDatosColumnaTablaCentro(2, jtUnitarioAsignado);
        alinearDatosColumnaTablaCentro(3, jtUnitarioAsignado);
        formateaAnchoColumnaTabla(0, jtUnitarioAsignado, 220);
        formateaAnchoColumnaTabla(1, jtUnitarioAsignado, 220);
        formateaAnchoColumnaTabla(2, jtUnitarioAsignado, 645);
        formateaAnchoColumnaTabla(3, jtUnitarioAsignado, 100);

    }

    public void eventoComboCategoria() {
        if (utilDepreciacion != null && jcbCategoria.getSelectedIndex() > 0) {
            utilDepreciacion.eventoComboCategoria(jcbCategoria, jcbAntiguedad, jcbMaterial, jcbEstado, jcbValorEstado);
        }
    }

    public void eventoComboAntiguedad() {
        if (utilDepreciacion != null && jcbAntiguedad.getSelectedIndex() > 0) {
            utilDepreciacion.eventoComboAntiguedad(jcbCategoria, jcbAntiguedad, jcbMaterial, jcbEstado, jcbValorEstado);
        }
    }

    public void eventoComboMaterial() {
        if (utilDepreciacion != null && jcbMaterial.getSelectedIndex() > 0) {
            utilDepreciacion.eventoComboMaterial(jcbCategoria, jcbAntiguedad, jcbMaterial, jcbEstado, jcbValorEstado);
        }
    }

    public void eventoComboEstado() {
        if (utilDepreciacion != null && jcbEstado.getSelectedIndex() > 0) {
            utilDepreciacion.eventoComboEstado(jcbCategoria, jcbAntiguedad, jcbMaterial, jcbEstado, jcbValorEstado);
            if (jcbValorEstado.getModel().getSize() > 0) {
                jcbValorEstado.setSelectedIndex(1);
                txfValorEstado.setText(jcbValorEstado.getSelectedItem().toString());
            } else {
            }
        }
    }

    public void eventoComboValorEstado() {
        if (utilDepreciacion != null && jcbValorEstado.getSelectedIndex() > 0) {
            utilDepreciacion.eventoComboValorEstado(jcbCategoria, jcbAntiguedad, jcbMaterial, jcbEstado, jcbValorEstado);
        }
    }

    void agregarUnitario(BEUnitario componente) {
        try {
            boolean c = false;
            for (int i = 0; i < modeloUnitarioAsignado.getRowCount(); i++) {
                if (modeloUnitarioAsignado.get(i).getUnitarioid() == componente.getUnitarioid()) {
                    JOptionPane.showMessageDialog(this, "El valor unitario ha sido seleccionado anteriormente, por favor seleccione otro.", "Atención", JOptionPane.INFORMATION_MESSAGE);
                    c = true;
                }
            }
            if (c == false) {
                modeloUnitarioAsignado.add(componente);
            }
        } catch (Exception e) {
            JOptionPane.showMessageDialog(this, "Error al asignar el valor unitario de edificación", "Atención", JOptionPane.INFORMATION_MESSAGE);
        }
    }

    public Double sumaUnitario() {
        Double suma = 0.0;
        for (BEUnitario s : modeloUnitarioAsignado.getList()) {
            suma = suma + s.getPrecio();
        }
        return suma;
    }

    public void cargar() {
        BEValuacionEdificacion beve;
        try {
            beve = bl.buscar(bl.obtenerUltimoId());
            parent.administrarPropiedad.agregarEdificacion(beve);
            System.out.println("Este es el id en bet: " + beve.getValuacionEdificacionId());
        } catch (Exception ex) {
            Logger.getLogger(JIFValuacionEdificacion.class.getName()).log(Level.SEVERE, null, ex);
        }
    }

    public double redondear(double numero) {
        BigDecimal big = new BigDecimal(numero);
        big = big.setScale(2, RoundingMode.HALF_UP);
        System.out.println("Este es el valor redondeado :" + new Double(big.toString()));
        return new Double(big.toString());
    }
}
